package com.sf.osms.dep.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Polymorphism;
import org.hibernate.annotations.PolymorphismType;

import com.sf.novatar.base.domain.LongIdBean;

@Entity
@Table(name = "wbs_tt_agent_config")
@Polymorphism(type = PolymorphismType.EXPLICIT)
public class AgentConfig extends LongIdBean implements Serializable{

	
	private static final long serialVersionUID = 1L;
	/**
	 * ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	private Long id; 
	/**
	 * 代理ID
	 */
	@Column(name = "AGENT_ID")
	private Long agentId; 
	/**
	 * 代理代码（eventCode,resonCode）
	 */
	@Column(name = "AGENT_CODE")
	private String agentCode; 
	/**
	 * 顺丰代码(eventCode,resonCode)
	 */
	@Column(name = "SF_CODE")
	private String sfCode; 
	/**
	 * 配置类型
	 */
	@Column(name = "CONFIG_TYPE")
	private Integer configType; 
	
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	public Long getAgentId() {
		return agentId;
	}
	public void setAgentId(Long agentId) {
		this.agentId = agentId;
	}
	public String getAgentCode() {
		return agentCode;
	}
	public void setAgentCode(String agentCode) {
		this.agentCode = agentCode;
	}
	public String getSfCode() {
		return sfCode;
	}
	public void setSfCode(String sfCode) {
		this.sfCode = sfCode;
	}
	public Integer getConfigType() {
		return configType;
	}
	public void setConfigType(Integer configType) {
		this.configType = configType;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj == null){
			return false;
		}
		if(obj instanceof AgentConfig){
			
			AgentConfig ac = (AgentConfig)obj;
			if(null != ac.getAgentCode() && ac.getAgentCode().equals(this.agentCode)){
				return true;
			}
			return false;
		}else{
			return false;
		}
		
	}
	@Override
	public int hashCode() {
		
		return super.hashCode();
	}
	@Override
	public String toString() {
		return "AgentConfig [id=" + id + ", agentId=" + agentId
				+ ", agentCode=" + agentCode + ", sfCode=" + sfCode
				+ ", configType=" + configType + "]";
	}
	
	public static void main(String[] args) {
		AgentConfig a = new AgentConfig();
		a.setAgentCode("111");
		AgentConfig b = new AgentConfig();
		
		
		System.out.println(a.equals(b));
	}
}
